diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 19:38:03 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-07 19:38:03 -0500 |
| commit | fb6cff2fe3101e80d2932285c0b03e0d5be872f8 (patch) | |
| tree | 5cad6b431044b9e622ad2b30b4f7db214d87905a /src/app/groups/[groupId]/share-button.tsx | |
| parent | 4bc03002e17a0d128059c9d6d76c91ba7bac2e8f (diff) | |
Share button
Diffstat (limited to 'src/app/groups/[groupId]/share-button.tsx')
| -rw-r--r-- | src/app/groups/[groupId]/share-button.tsx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/app/groups/[groupId]/share-button.tsx b/src/app/groups/[groupId]/share-button.tsx new file mode 100644 index 0000000..808f3a0 --- /dev/null +++ b/src/app/groups/[groupId]/share-button.tsx @@ -0,0 +1,42 @@ +import { CopyButton } from '@/components/copy-button' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover' +import { env } from '@/lib/env' +import { Share } from 'lucide-react' + +type Props = { + groupId: string +} + +export function ShareButton({ groupId }: Props) { + const url = `${env.NEXT_PUBLIC_BASE_URL}/groups/${groupId}` + + return ( + <Popover> + <PopoverTrigger asChild> + <Button size="icon"> + <Share className="w-4 h-4" /> + </Button> + </PopoverTrigger> + <PopoverContent align="end" className="[&_p]:text-sm flex flex-col gap-3"> + <p> + For other participants to see the group and add expenses, share its + URL with them. + </p> + <div className="flex gap-2"> + <Input className="flex-1" defaultValue={url} readOnly /> + <CopyButton text={url} /> + </div> + <p> + <strong>Warning!</strong> Every person with the group URL will be able + to see and edit expenses. Share with caution! + </p> + </PopoverContent> + </Popover> + ) +} |
